package com.dolphin.business.manager.impl;

import com.dolphin.business.common.utils.PagerModel;
import com.dolphin.business.entity.ChatMessage;
import com.dolphin.business.manager.AbstractManager;
import com.dolphin.business.manager.ChatMessageManager;

public class ChatMessageManagerImpl extends AbstractManager implements ChatMessageManager {

	@Override
	public void addChatMessage(ChatMessage chatMessage) {

		getHibernateTemplate().save(chatMessage);
	}

	@Override
	public void delChatMessageById(String id) {

		getHibernateTemplate().delete(findChatMessageById(id));
	}

	@Override
	public PagerModel findAllChatMessage() {
		
		return searchPaginate("select cm from ChatMessage cm");
	}



	@Override
	public void updateCharMessage(ChatMessage chatMessage) {

		getHibernateTemplate().update(chatMessage);
	}

	@Override
	public ChatMessage findChatMessageById(String id) {

		return (ChatMessage)getHibernateTemplate().load(ChatMessage.class, id);
	}

}
